package com.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.resume.constant.GlobalConst;
import com.resume.domain.XueLi;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.resume.domain.City;
import com.resume.mapper.CityMapper;
import com.resume.service.CityService;


@Service
public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements CityService {

    @Override
    public List<City> listAllUsablecity() {
        QueryWrapper<City> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id", "name")
                .eq("status", GlobalConst.Common.STATUS_ENABLE)
                .orderByDesc("priority");
        List<City> cityList = baseMapper.selectList(queryWrapper);
        return cityList;
    }

    @Override
    public boolean modifyCityStatus(Integer id, Integer status) {
        City city = City.builder()
                .id(id)
                .status(status)
                .build();
        int ss = baseMapper.updateById(city);
        return ss == 1 ? true : false;

    }

}
